from xml.etree.ElementTree import SubElement
from DcmConfig.DidInput import DcmDidCfg
from ArxmlBasicTools.Arxml import *

class DcmDIDConfig(arxmlFile):

    DcmDspContainers_el = 'no define'
    NvM_Containers_el = 'no define'

    def __init__(self) -> None:
        super(DcmDIDConfig, self).__init__()
        self.Project_el = self.createArxmlPackage('ETAS_Project/EcucModuleConfigurationValuess')

    def genDcmDsp(self,Project_el):
        
        DcmCONTAINERS_el = addModule(Project_el,'Dcm',r'/AUTOSAR_Dcm/EcucModuleDefs/Dcm')
        CONTAINER_DcmConfigSet_el = addContainer(DcmCONTAINERS_el,'DcmConfigSet','ECUC-PARAM-CONF-CONTAINER-DEF',r'/AUTOSAR_Dcm/EcucModuleDefs/Dcm/DcmConfigSet')
        
        DcmConfigSet_SUB_CONTAINERS_el = SubElement(CONTAINER_DcmConfigSet_el,'SUB-CONTAINERS')
        CONTAINER_DcmDsp_el = addContainer(DcmConfigSet_SUB_CONTAINERS_el,'DcmDsp','ECUC-PARAM-CONF-CONTAINER-DEF',\
                                           r'/AUTOSAR_Dcm/EcucModuleDefs/Dcm/DcmConfigSet/DcmDsp')
        return CONTAINER_DcmDsp_el
    
    def genNvMModule(self,Project_el):
        
        NvMCONTAINERS_el = addModule(Project_el,'NvM',r'/AUTOSAR_NvM/EcucModuleDefs/NvM')
        return NvMCONTAINERS_el

    def addNvMDid_cfg(self,DcmDidCfg: DcmDidCfg):
        if DcmDidCfg.didWriteEn == True or DcmDidCfg.storeLoc == 'EEPROM':
            if self.NvM_Containers_el == 'no define':
                self.NvM_Containers_el = self.genNvMModule(self.Project_el)  
            CONTAINER_Nvm_el = addContainer(self.NvM_Containers_el,'NvMBlockDescriptor_' + DcmDidCfg.didNum,'ECUC-PARAM-CONF-CONTAINER-DEF',\
                                            r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor')
            Nvm_PARAMETER_VALUES = SubElement(CONTAINER_Nvm_el,'PARAMETER-VALUES')
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-TEXTUAL-PARAM-VALUE','ECUC-ENUMERATION-PARAM-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMBlockCrcType',\
                            'NVM_CRC16')
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-NUMERICAL-PARAM-VALUE','ECUC-BOOLEAN-PARAM-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMBlockUseAutoValidation',\
                            '0')
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-NUMERICAL-PARAM-VALUE','ECUC-BOOLEAN-PARAM-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMBlockUseCRCCompMechanism',\
                            '0')
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-NUMERICAL-PARAM-VALUE','ECUC-BOOLEAN-PARAM-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMBlockUseSyncMechanism',\
                            '0')
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-NUMERICAL-PARAM-VALUE','ECUC-BOOLEAN-PARAM-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMCalcRamBlockCrc',\
                            '0')
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-TEXTUAL-PARAM-VALUE','ECUC-FUNCTION-NAME-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMInitBlockCallback',\
                            'NULL_PTR')
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-TEXTUAL-PARAM-VALUE','ECUC-STRING-PARAM-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMRamBlockDataAddress',\
                            'NvM_DID_' + DcmDidCfg.didNum)
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-NUMERICAL-PARAM-VALUE','ECUC-BOOLEAN-PARAM-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMRbFirstReadDataMigration',\
                            '0')
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-NUMERICAL-PARAM-VALUE','ECUC-BOOLEAN-PARAM-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMRbGenRteAdminPort',\
                            '0')
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-NUMERICAL-PARAM-VALUE','ECUC-BOOLEAN-PARAM-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMRbGenRteServicePort',\
                            '1')
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-NUMERICAL-PARAM-VALUE','ECUC-BOOLEAN-PARAM-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMRbInitBlockAtLayoutChange',\
                            '0')
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-NUMERICAL-PARAM-VALUE','ECUC-BOOLEAN-PARAM-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMRbNoFallback',\
                            '0')
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-TEXTUAL-PARAM-VALUE','ECUC-STRING-PARAM-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMRbRamBlockDataAddressString',\
                            'NULL_PTR')
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-NUMERICAL-PARAM-VALUE','ECUC-BOOLEAN-PARAM-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMRbRamInitUnconditional',\
                            '0')
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-NUMERICAL-PARAM-VALUE','ECUC-BOOLEAN-PARAM-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMRbResistantToLayoutRemoval',\
                            '0')
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-NUMERICAL-PARAM-VALUE','ECUC-BOOLEAN-PARAM-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMRbSelectBlockForFirstInitAll',\
                            '0')
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-TEXTUAL-PARAM-VALUE','ECUC-FUNCTION-NAME-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMRbSingleBlockStartCallback',\
                            'NULL_PTR')
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-NUMERICAL-PARAM-VALUE','ECUC-BOOLEAN-PARAM-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMRbWriteCounter',\
                            '0')
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-TEXTUAL-PARAM-VALUE','ECUC-FUNCTION-NAME-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMReadRamBlockFromNvCallback',\
                            'NULL_PTR')
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-TEXTUAL-PARAM-VALUE','ECUC-STRING-PARAM-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMRomBlockDataAddress',\
                            'NULL_PTR')
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-NUMERICAL-PARAM-VALUE','ECUC-BOOLEAN-PARAM-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMSelectBlockForReadAll',\
                            '1')
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-NUMERICAL-PARAM-VALUE','ECUC-BOOLEAN-PARAM-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMSelectBlockForWriteAll',\
                            '1')
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-TEXTUAL-PARAM-VALUE','ECUC-FUNCTION-NAME-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMSingleBlockCallback',\
                            'NULL_PTR')
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-TEXTUAL-PARAM-VALUE','ECUC-FUNCTION-NAME-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMWriteRamBlockToNvCallback',\
                            'NULL_PTR')
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-NUMERICAL-PARAM-VALUE','ECUC-INTEGER-PARAM-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMBlockJobPriority',\
                            '1')
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-TEXTUAL-PARAM-VALUE','ECUC-ENUMERATION-PARAM-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMBlockManagementType',\
                            'NVM_BLOCK_NATIVE')
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-NUMERICAL-PARAM-VALUE','ECUC-BOOLEAN-PARAM-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMBlockUseCrc',\
                            'true')
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-NUMERICAL-PARAM-VALUE','ECUC-BOOLEAN-PARAM-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMBlockWriteProt',\
                            'false')
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-NUMERICAL-PARAM-VALUE','ECUC-INTEGER-PARAM-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMMaxNumOfReadRetries',\
                            '0')
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-NUMERICAL-PARAM-VALUE','ECUC-INTEGER-PARAM-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMMaxNumOfWriteRetries',\
                            '0')
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-NUMERICAL-PARAM-VALUE','ECUC-INTEGER-PARAM-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMNvBlockLength',\
                            str(DcmDidCfg.didLen))
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-NUMERICAL-PARAM-VALUE','ECUC-INTEGER-PARAM-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMNvBlockNum',\
                            '1')
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-NUMERICAL-PARAM-VALUE','ECUC-INTEGER-PARAM-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMNvramDeviceId',\
                            '0')
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-NUMERICAL-PARAM-VALUE','ECUC-BOOLEAN-PARAM-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMResistantToChangedSw',\
                            'false')
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-NUMERICAL-PARAM-VALUE','ECUC-INTEGER-PARAM-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMRomBlockNum',\
                            '0')
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-NUMERICAL-PARAM-VALUE','ECUC-BOOLEAN-PARAM-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMStaticBlockIDCheck',\
                            'false')
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-NUMERICAL-PARAM-VALUE','ECUC-BOOLEAN-PARAM-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMWriteBlockOnce',\
                            'false')
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-NUMERICAL-PARAM-VALUE','ECUC-BOOLEAN-PARAM-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMWriteVerification',\
                            'false')
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-NUMERICAL-PARAM-VALUE','ECUC-INTEGER-PARAM-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMWriteVerificationDataSize',\
                            '0')
            addParameter(Nvm_PARAMETER_VALUES,'ECUC-NUMERICAL-PARAM-VALUE','ECUC-INTEGER-PARAM-DEF',\
                        r'/AUTOSAR_NvM/EcucModuleDefs/NvM/NvMBlockDescriptor/NvMRbBlockPersistentId',\
                            str(int(DcmDidCfg.didNum,16)))
            
    def addDspDid_cfg(self,DcmDidCfg: DcmDidCfg):
        if self.DcmDspContainers_el == 'no define':
            self.DcmDspContainers_el = self.genDcmDsp(self.Project_el)

        DcmDspSUB_CONTAINERS_el = SubElement(self.DcmDspContainers_el,'SUB-CONTAINERS')

        CONTAINER_DcmDspData_el = addContainer(DcmDspSUB_CONTAINERS_el,'DcmDspData_0x' + DcmDidCfg.didNum,'ECUC-PARAM-CONF-CONTAINER-DEF',\
                                               r'/AUTOSAR_Dcm/EcucModuleDefs/Dcm/DcmConfigSet/DcmDsp/DcmDspData')
        DcmDspData_PARAMETER_VALUES = SubElement(CONTAINER_DcmDspData_el,'PARAMETER-VALUES')

        addParameter(DcmDspData_PARAMETER_VALUES,'ECUC-NUMERICAL-PARAM-VALUE','ECUC-BOOLEAN-PARAM-DEF',\
                     r'/AUTOSAR_Dcm/EcucModuleDefs/Dcm/DcmConfigSet/DcmDsp/DcmDspData/DcmRbDspDataUseAsynchronousServerCallPoint',\
                        '0')
        addParameter(DcmDspData_PARAMETER_VALUES,'ECUC-NUMERICAL-PARAM-VALUE','ECUC-INTEGER-PARAM-DEF',\
                     r'/AUTOSAR_Dcm/EcucModuleDefs/Dcm/DcmConfigSet/DcmDsp/DcmDspData/DcmDspDataSize',\
                        str(DcmDidCfg.didLen * 8))
        addParameter(DcmDspData_PARAMETER_VALUES,'ECUC-TEXTUAL-PARAM-VALUE','ECUC-ENUMERATION-PARAM-DEF',\
                     r'/AUTOSAR_Dcm/EcucModuleDefs/Dcm/DcmConfigSet/DcmDsp/DcmDspData/DcmDspDataType',\
                        'UINT8_N')
        addParameter(DcmDspData_PARAMETER_VALUES,'ECUC-TEXTUAL-PARAM-VALUE','ECUC-ENUMERATION-PARAM-DEF',\
                     r'/AUTOSAR_Dcm/EcucModuleDefs/Dcm/DcmConfigSet/DcmDsp/DcmDspData/DcmDspDataUsePort',\
                        'USE_DATA_SYNCH_FNC')                
        addParameter(DcmDspData_PARAMETER_VALUES,'ECUC-TEXTUAL-PARAM-VALUE','ECUC-FUNCTION-NAME-DEF',\
                     r'/AUTOSAR_Dcm/EcucModuleDefs/Dcm/DcmConfigSet/DcmDsp/DcmDspData/DcmDspDataReadFnc',\
                        'DcmDspDataReadFnc_0x' +  DcmDidCfg.didNum)  
        addParameter(DcmDspData_PARAMETER_VALUES,'ECUC-TEXTUAL-PARAM-VALUE','ECUC-ENUMERATION-PARAM-DEF',\
                     r'/AUTOSAR_Dcm/EcucModuleDefs/Dcm/DcmConfigSet/DcmDsp/DcmDspData/DcmDspDataEndianness',\
                        'BIG_ENDIAN')  
        addParameter(DcmDspData_PARAMETER_VALUES,'ECUC-TEXTUAL-PARAM-VALUE','ECUC-FUNCTION-NAME-DEF',\
                     r'/AUTOSAR_Dcm/EcucModuleDefs/Dcm/DcmConfigSet/DcmDsp/DcmDspData/DcmDspDataWriteFnc',\
                        'DcmDspDataWriteFnc_0x' +  DcmDidCfg.didNum)          

        CONTAINER_DcmDspDidInfo_el = addContainer(DcmDspSUB_CONTAINERS_el,'DcmDspDidInfo_0x' + DcmDidCfg.didNum,'ECUC-PARAM-CONF-CONTAINER-DEF',\
                                                  r'/AUTOSAR_Dcm/EcucModuleDefs/Dcm/DcmConfigSet/DcmDsp/DcmDspDidInfo')
        DcmDspDidInfo_PARAMETER_VALUES = SubElement(CONTAINER_DcmDspDidInfo_el,'PARAMETER-VALUES')

        addParameter(DcmDspDidInfo_PARAMETER_VALUES,'ECUC-NUMERICAL-PARAM-VALUE','ECUC-BOOLEAN-PARAM-DEF',\
                     r'/AUTOSAR_Dcm/EcucModuleDefs/Dcm/DcmConfigSet/DcmDsp/DcmDspDidInfo/DcmDspDidDynamicallyDefined',\
                        'FALSE') 
        
        DcmDspDidInfo_SUB_CONTAINERS_el = SubElement(CONTAINER_DcmDspDidInfo_el,'SUB-CONTAINERS')

        if DcmDidCfg.didReadEn == True:

            CONTAINER_DcmDspDidRead_el = addContainer(DcmDspDidInfo_SUB_CONTAINERS_el,'DcmDspDidRead','ECUC-PARAM-CONF-CONTAINER-DEF',\
                                                      r'/AUTOSAR_Dcm/EcucModuleDefs/Dcm/DcmConfigSet/DcmDsp/DcmDspDidInfo/DcmDspDidRead')
            DcmDspDidRead_REFERENCE_VALUES_el = SubElement(CONTAINER_DcmDspDidRead_el,'REFERENCE-VALUES')

            addReference(DcmDspDidRead_REFERENCE_VALUES_el,'ECUC-REFERENCE-DEF',\
                         r'/AUTOSAR_Dcm/EcucModuleDefs/Dcm/DcmConfigSet/DcmDsp/DcmDspDidInfo/DcmDspDidRead/DcmDspDidReadSessionRef',\
                         r'/ETAS_Project/EcucModuleConfigurationValuess/Dcm/DcmConfigSet/DcmDsp/DcmDspSession/Default')
            addReference(DcmDspDidRead_REFERENCE_VALUES_el,'ECUC-REFERENCE-DEF',\
                         r'/AUTOSAR_Dcm/EcucModuleDefs/Dcm/DcmConfigSet/DcmDsp/DcmDspDidInfo/DcmDspDidRead/DcmDspDidReadSessionRef',\
                         r'/ETAS_Project/EcucModuleConfigurationValuess/Dcm/DcmConfigSet/DcmDsp/DcmDspSession/Extended')

        if DcmDidCfg.didWriteEn == True:
            CONTAINER_DcmDspDidWrite_el = addContainer(DcmDspDidInfo_SUB_CONTAINERS_el,'DcmDspDidWrite','ECUC-PARAM-CONF-CONTAINER-DEF',\
                                                      r'/AUTOSAR_Dcm/EcucModuleDefs/Dcm/DcmConfigSet/DcmDsp/DcmDspDidInfo/DcmDspDidWrite')
            DcmDspDidWrite_REFERENCE_VALUES_el = SubElement(CONTAINER_DcmDspDidWrite_el,'REFERENCE-VALUES')

            addReference(DcmDspDidWrite_REFERENCE_VALUES_el,'ECUC-REFERENCE-DEF',\
                         r'/AUTOSAR_Dcm/EcucModuleDefs/Dcm/DcmConfigSet/DcmDsp/DcmDspDidInfo/DcmDspDidWrite/DcmDspDidWriteSessionRef',\
                         r'/ETAS_Project/EcucModuleConfigurationValuess/Dcm/DcmConfigSet/DcmDsp/DcmDspSession/Extended')
            addReference(DcmDspDidWrite_REFERENCE_VALUES_el,'ECUC-REFERENCE-DEF',\
                         r'/AUTOSAR_Dcm/EcucModuleDefs/Dcm/DcmConfigSet/DcmDsp/DcmDspDidInfo/DcmDspDidWrite/DcmDspDidWriteSecurityLevelRef',\
                         r'/ETAS_Project/EcucModuleConfigurationValuess/Dcm/DcmConfigSet/DcmDsp/DcmDspSecurity/UnlockedL1')

        DcmDspDid_CONTAINER_el = addContainer(DcmDspSUB_CONTAINERS_el,'DcmDspDid_0x' + DcmDidCfg.didNum,'ECUC-PARAM-CONF-CONTAINER-DEF',\
                                              r'/AUTOSAR_Dcm/EcucModuleDefs/Dcm/DcmConfigSet/DcmDsp/DcmDspDid')
        
        DcmDspDid_PARAMETER_VALUES = SubElement(DcmDspDid_CONTAINER_el,'PARAMETER-VALUES')
        addParameter(DcmDspDid_PARAMETER_VALUES,'ECUC-TEXTUAL-PARAM-VALUE','ECUC-ENUMERATION-PARAM-DEF',\
                     r'/AUTOSAR_Dcm/EcucModuleDefs/Dcm/DcmConfigSet/DcmDsp/DcmDspDid/DcmDspDidUsePort','USE_DATA_ELEMENT_SPECIFIC_INTERFACES')
        addParameter(DcmDspDid_PARAMETER_VALUES,'ECUC-NUMERICAL-PARAM-VALUE','ECUC-BOOLEAN-PARAM-DEF',\
                     r'/AUTOSAR_Dcm/EcucModuleDefs/Dcm/DcmConfigSet/DcmDsp/DcmDspDid/DcmRbAtomicSenderReceiverCommunication','0')
        addParameter(DcmDspDid_PARAMETER_VALUES,'ECUC-NUMERICAL-PARAM-VALUE','ECUC-INTEGER-PARAM-DEF',\
                     r'/AUTOSAR_Dcm/EcucModuleDefs/Dcm/DcmConfigSet/DcmDsp/DcmDspDid/DcmDspDidIdentifier',str(int(DcmDidCfg.didNum,16)))

        DcmDspDid_REFERENCE_VALUES_el = SubElement(DcmDspDid_CONTAINER_el,'REFERENCE-VALUES')
        addReference(DcmDspDid_REFERENCE_VALUES_el,'ECUC-REFERENCE-DEF',\
                     r'/AUTOSAR_Dcm/EcucModuleDefs/Dcm/DcmConfigSet/DcmDsp/DcmDspDid/DcmDspDidInfoRef',\
                     r'/ETAS_Project/EcucModuleConfigurationValuess/Dcm/DcmConfigSet/DcmDsp/DcmDspDidInfo_0x' +  DcmDidCfg.didNum)

        DcmDspDid_SUB_CONTAINERS_el = SubElement(DcmDspDid_CONTAINER_el,'SUB-CONTAINERS')

        CONTAINER_DcmDspDidSignal_el = addContainer(DcmDspDid_SUB_CONTAINERS_el,'DcmDspDidSignal_FLCBootSWIdentifierBootloader','ECUC-PARAM-CONF-CONTAINER-DEF',\
                     r'/AUTOSAR_Dcm/EcucModuleDefs/Dcm/DcmConfigSet/DcmDsp/DcmDspDid/DcmDspDidSignal')
        
        DcmDspDidSignal_PARAMETER_VALUES = SubElement(CONTAINER_DcmDspDidSignal_el,'PARAMETER-VALUES')
        addParameter(DcmDspDidSignal_PARAMETER_VALUES,'ECUC-NUMERICAL-PARAM-VALUE','ECUC-INTEGER-PARAM-DEF',\
                     r'/AUTOSAR_Dcm/EcucModuleDefs/Dcm/DcmConfigSet/DcmDsp/DcmDspDid/DcmDspDidSignal/DcmDspDidDataPos','0')
        
        DcmDspDidSignal_REFERENCE_VALUES_el = SubElement(CONTAINER_DcmDspDidSignal_el,'REFERENCE-VALUES')
        addReference(DcmDspDidSignal_REFERENCE_VALUES_el,'ECUC-REFERENCE-DEF',\
                     r'/AUTOSAR_Dcm/EcucModuleDefs/Dcm/DcmConfigSet/DcmDsp/DcmDspDid/DcmDspDidSignal/DcmDspDidDataRef',\
                     r'/ETAS_Project/EcucModuleConfigurationValuess/Dcm/DcmConfigSet/DcmDsp/DcmDspData_0x' +  DcmDidCfg.didNum)
